pspdebug.h

Go to the documentation of this file.
00001 /*
00002  * PSP Software Development Kit - http://www.pspdev.org
00003  * -----------------------------------------------------------------------
00004  * Licensed under the BSD license, see LICENSE in PSPSDK root for details.
00005  *
00006  *  pspdebug.h - Prototypes for the pspDebug library
00007  *
00008  * Copyright (c) 2005 Marcus R. Brown <mrbrown@ocgnet.org>
00009  * Copyright (c) 2005 James Forshaw <tyranid@gmail.com>
00010  * Copyright (c) 2005 John Kelley <ps2dev@kelley.ca>
00011  *
00012  * $Id: pspdebug.h 2017 2006-10-07 16:51:57Z tyranid $
00013  */
00014 #ifndef __DEBUG_H__
00015 #define __DEBUG_H__
00016 
00017 #include <psptypes.h>
00018 #include <pspmoduleinfo.h>
00019 
00020 #ifdef __cplusplus
00021 extern "C" {
00022 #endif
00023 
00028 
00032 void pspDebugScreenInit(void);
00033 
00041 void pspDebugScreenInitEx(void *vram_base, int mode, int setup);
00042 
00049 void pspDebugScreenPrintf(const char *fmt, ...) __attribute__((format(printf,1,2)));
00050 
00057 void pspDebugScreenSetBackColor(u32 color);
00058 
00064 void pspDebugScreenSetTextColor(u32 color);
00065 
00071 void pspDebugScreenSetColorMode(int mode);
00072 
00081 void pspDebugScreenPutChar(int x, int y, u32 color, u8 ch);
00082 
00086 void pspDebugScreenSetXY(int x, int y);
00087 
00093 void pspDebugScreenSetOffset(int offset);
00094 
00100 void pspDebugScreenSetBase(u32* base);
00101 
00107 int pspDebugScreenGetX(void);
00108 
00114 int pspDebugScreenGetY(void);
00115 
00119 void pspDebugScreenClear(void);
00120 
00129 int pspDebugScreenPrintData(const char *buff, int size);
00130 
00138 int pspDebugScreenPuts(const char *str);
00139 
00148 int pspDebugGetStackTrace(unsigned int* results, int max);
00149 
00151 typedef struct _PspDebugRegBlock
00152 {
00153         u32 frame[6];
00155         u32 r[32];
00157         u32 status;
00159         u32 lo;
00160         u32 hi;
00161         u32 badvaddr;
00162         u32 cause;
00163         u32 epc;
00164         float fpr[32];
00165         u32 fsr;
00166         u32 fir;
00167         u32 frame_ptr;
00168         u32 unused;
00169         /* Unused on PSP */
00170         u32 index;
00171         u32 random;
00172         u32 entrylo0;
00173         u32 entrylo1;
00174         u32 context;
00175         u32 pagemask;
00176         u32 wired;
00177         u32 cop0_7;
00178         u32 cop0_8;
00179         u32 cop0_9;
00180         u32 entryhi;
00181         u32 cop0_11;
00182         u32 cop0_12;
00183         u32 cop0_13;
00184         u32 cop0_14;
00185         /* PRId should still be okay */
00186         u32 prid;
00187         u32 padding[100];
00188 } PspDebugRegBlock;
00189 
00191 typedef void (*PspDebugErrorHandler)(PspDebugRegBlock *regs);
00192 
00200 int pspDebugInstallErrorHandler(PspDebugErrorHandler handler);
00201 
00210 void pspDebugDumpException(PspDebugRegBlock *regs);
00211 
00213 typedef int (*PspDebugKprintfHandler)(const char *format, u32 *args);
00214 
00221 int pspDebugInstallKprintfHandler(PspDebugKprintfHandler handler);
00222 
00224 typedef struct _PspDebugStackTrace
00225 {
00227         u32 call_addr;
00229         u32 func_addr;
00230 } PspDebugStackTrace;
00231 
00244 int pspDebugGetStackTrace2(PspDebugRegBlock *regs, PspDebugStackTrace *trace, int max);
00245 
00247 typedef struct _PspDebugProfilerRegs
00248 {
00249         volatile u32 enable;
00250         volatile u32 systemck;
00251         volatile u32 cpuck;
00252         volatile u32 stall;
00253         volatile u32 internal;
00254         volatile u32 memory;
00255         volatile u32 copz;
00256         volatile u32 vfpu;
00257         volatile u32 sleep;
00258         volatile u32 bus_access;
00259         volatile u32 uncached_load;
00260         volatile u32 uncached_store;
00261         volatile u32 cached_load;
00262         volatile u32 cached_store;
00263         volatile u32 i_miss;
00264         volatile u32 d_miss;
00265         volatile u32 d_writeback;
00266         volatile u32 cop0_inst;
00267         volatile u32 fpu_inst;
00268         volatile u32 vfpu_inst;
00269         volatile u32 local_bus;
00270 } PspDebugProfilerRegs;
00271 
00273 void pspDebugProfilerEnable(void);
00274 
00276 void pspDebugProfilerDisable(void);
00277 
00279 void pspDebugProfilerClear(void);
00280 
00285 void pspDebugProfilerGetRegs(PspDebugProfilerRegs *regs);
00286 
00288 void pspDebugProfilerPrint(void);
00289 
00291 typedef int (*PspDebugPrintHandler)(const char *data, int len);
00292 
00294 typedef int (*PspDebugInputHandler)(char *data, int len);
00295 
00303 int pspDebugInstallStdinHandler(PspDebugInputHandler handler);
00304 
00312 int pspDebugInstallStdoutHandler(PspDebugPrintHandler handler);
00313 
00321 int pspDebugInstallStderrHandler(PspDebugPrintHandler handler);
00322 
00328 void pspDebugSioPutchar(int ch);
00329 
00335 int pspDebugSioGetchar(void);
00336 
00342 void pspDebugSioPuts(const char *str);
00343 
00352 int pspDebugSioPutData(const char *data, int len);
00353 
00363 int pspDebugSioPutText(const char *data, int len);
00364 
00369 void pspDebugSioInit(void);
00370 
00375 void pspDebugSioSetBaud(int baud);
00376 
00381 void pspDebugEnablePutchar(void);
00382 
00388 void pspDebugSioInstallKprintf(void);
00389 
00393 void pspDebugGdbStubInit(void);
00394 
00398 void pspDebugBreakpoint(void);
00399 
00403 void pspDebugSioEnableKprintf(void);
00404 
00408 void pspDebugSioDisableKprintf(void);
00409 
00412 #ifdef __cplusplus
00413 }
00414 #endif
00415 
00416 #endif

Generated on Tue Nov 21 11:46:03 2006 for pspsdk-1.0+beta2 by  doxygen 1.4.6